import { createApp, reactive } from 'vue'
import $loading from './myLoading/myLoad'


var message = reactive({
    show: false,
    title: '拼命加载中'
})

let CreateLoading = createApp($loading, {message}).mount(document.createElement('div'))

const load = {
    hide() {
        message.show = false
    },

    show(msg) {
        message.show = true
        message.title = msg
        document.body.appendChild(CreateLoading.$el)
    }
}

export default {
    install(app) {
        app.config.globalProperties.$loading = load 
        app.mixin({
            created() {
                this.$loading = load
            }
        })
    }
}